<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>添加员工</title>
  <link rel="stylesheet" href="../../../layui/css/layui.css">
  <script src="../../../layui/layui.js"></script>
    <script type="text/javascript" src="../../../js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="../../../js/main.js"></script>
</head>
<style type="text/css">
 body{
  height: 100%;
  width: 100%;
 }
 .layui-form-label{width: 130px}
 .btn {
    background-color: #e5e5e5;
    background-image: none;
    filter: none;
    border: 0;
    padding: 7px 14px;
    text-shadow: none;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #333333;
    cursor: pointer;
    outline: none;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    box-shadow: none !important;
    -webkit-border-radius: 0 !important;
    -moz-border-radius: 0 !important;
    border-radius: 0 !important;
}
.layui-input-inline{width: 214px !important}
</style>

<body>
 <!-- 内容主体区域 -->
 <div class="x-body layui-anim layui-anim-up">
  <div class="layui-fluid">
  
    <form class="layui-form layui-form-pane1" lay-filter="first">
        <div class="layui-form-item">
        </div>
      <div class="layui-form-item">
         <label class="layui-form-label"><span class="text-error">*</span>员工名称：</label>
         <div class="layui-input-inline">
          <input name="stuffName" id="stuffName" placeholder="请输入" value="" class="layui-input">
          </div>
      </div>
       <div class="layui-form-item">
         <label class="layui-form-label"><span class="text-error">*</span>手机号码：</label>
         <div class="layui-input-inline">
          <input name="tel" id="tel" placeholder="请输入"  value="" class="layui-input">
          </div>
      </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别：</label>
            <div class="layui-input-block">
                <input type="radio" name="gender" value="0" title="男" checked="">
                <input type="radio" name="gender" value="1" title="女">
<!--                <input type="radio" name="gender" value="禁" title="禁用" disabled="">-->
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">职位</label>
            <div class="layui-input-block">
                <input type="radio" name="jobLevel" value="2" title="前台" checked="">
                <input type="radio" name="jobLevel" value="3" title="顾问">
                <input type="radio" name="jobLevel" value="4" title="美容师" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="text-error">*</span>爱好：</label>
            <div class="layui-input-inline">
                <input name="special" id="special" placeholder="请输入"  value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="text-error">*</span>梦想：</label>
            <div class="layui-input-inline">
                <input name="dream" id="dream" placeholder="请输入"  value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="text-error">*</span>微信：</label>
            <div class="layui-input-inline">
                <input name="weixin" id="weixin" placeholder="请输入"  value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="text-error">*</span> QQ：</label>
            <div class="layui-input-inline">
                <input name="qq" id="qq" placeholder="请输入"  value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span class="text-error">*</span> 地址：</label>
            <div class="layui-input-inline">
                <input name="address" id="address" placeholder="请输入"  value="" class="layui-input">
            </div>
        </div>
      <div class="layui-form-item">
         <label class="layui-form-label">工作年限：</label>
         <div class="layui-input-inline">
          <input name="workAge" id="workAge" placeholder="请输入"  value="" class="layui-input">
          </div>
      </div>
        <div class="layui-form-item" style="margin-left: 140px;">
            <!--<p id="btnGroup" class="pull-right">-->
                <button class="layui-btn save"  lay-submit="" lay-filter="*">保存</button>
                <button class="layui-btn quxiao" >取消</button>
            <!--</p>-->
        </div>
        <input name="recordId" id="recordId"  type="hidden" value="" class="layui-input">

        <input name="storeId" id="storeId"  type="hidden" value="" class="layui-input">
    </form>
  </div>
  </div>
  </body>
  </html>
<script type="text/javascript">
    function child(data){
        var $ = layui.jquery;
        $("#storeId").val(data.storeId);

        var recordId = data.recordId;
        if(recordId!=undefined){
            $("#recordId").val(recordId);
            var stuffName = data.stuffName;
            $("#stuffName").val(stuffName);

            var tel = data.tel;
            $("#tel").val(tel);

            var gender = data.gender;
            var radio = document.getElementsByName("gender");
            var radioLength = radio.length;
            for (var i = 0; i < radioLength; i++) {
                if(gender == radio[i].value){
                    $(radio[i]).next().click();
                }

            }


            var jobLevel = data.jobLevel;
            var temp = jobLevel.split(",");
            console.log(temp[0]);
            var radio = document.getElementsByName("jobLevel");
            var radioLength = radio.length;
            for (var i = 0; i < radioLength; i++) {
                if(temp[0] == radio[i].value){
                    $(radio[i]).next().click();
                }

            }

            var special = data.special;
            $("#special").val(special);

            var dream = data.dream;
            $("#dream").val(dream);

            var qq = data.qq;
            $("#qq").val(qq);

            var weixin = data.weixin;
            $("#weixin").val(weixin);

            var address = data.address;
            $("#address").val(address);

            var email = data.email;
            $("#email").val(email);

            var workAge = data.workAge;
            $("#workAge").val(workAge);

        }


/*        var $ = layui.jquery;
        var userCode = data.userCode;
        $('#userCode').val(userCode);
        var userName = data.userName;
        $('#userName').val(userName);

        var recordId = data.recordId;
        $('#recordId').val(recordId);

        var userStatus = data.userStatus;
        if(userStatus==1){
            $("#userStatus").attr("checked",'checked');
        }
        var email = data.email;
        $('#email').val(email);

        console.log(data);*/
    }

    layui.use(['element', 'layer', 'jquery','form','laydate','upload'], function () {
	  var form = layui.form;
	  var $ = layui.jquery;
	  var laydate=layui.laydate;
	  /* function quxiao(){
	  	alert(111);
	  } */
	   var $ = layui.jquery,
	   upload = layui.upload;

	  form.on('submit(*)', function(data){
	  	console.log(data.field);
	  	if(data.field.userStatus=='on'){
            data.field.userStatus = 1
        }else{
            data.field.userStatus = 0;
        }
	    var url ='';
	    if($('#recordId').val()!==""){
            url = '/hy/basic/stuff/updateStuffData';
	    }else{
            url = '/hy/basic/stuff/addStuff';
	    }
	    $.ajax({
	    	type:'POST',
            url:url,
	    	data: data.field,
	    	success: function(data){
	    	    if(data.msgcode=="200"){
                    alert("操作失败！");
                }else{
                    alert("操作成功！");
                    window.parent.location.reload(); //刷新父页面
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    parent.layer.close(index);  // 关闭layer
                }

	    		/* alert("操作成功");
	    		if(type=="update"){
		    		window.parent.location.reload(); //刷新父页面
					var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
					parent.layer.close(index);  // 关闭layer
	    		}else{
	    			window.location.reload();
	    			//window.location.href="${basePath}ryOrderConfig/queryList";
	    		} */
		    	
	    	//window.location.href="${basePath}ryOrderConfig/queryList";
	    	}
	    })
	    return false;
	  });

})


</script>  